package sl;

import java.lang.reflect.Field;

public class main6 {
    public static void main(String[] args) throws Exception {
        Class clz=Class.forName("entity.Person");
        Object person=clz.newInstance();

        Field name=clz.getDeclaredField("name");

        name.setAccessible(true);

        System.out.println("赋值前的name："+name.get(person));

        name.set(person,"New Person");

        System.out.println("赋值后的name:"+name.get(person));
    }
}
